import axios from 'axios'

const logininfo = JSON.parse(localStorage.getItem("logininfo"))  // 把字符串转json格式

const http = axios.create({
    // baseURL:"http://1.117.145.47:80",
    // headers:{
    //     token:logininfo.token
    // }
})
if (logininfo){
    http.defaults.headers.common['token'] = logininfo.token;
    http.defaults.headers.common['username'] = logininfo.user;
}


// 添加拦截器
// http.interceptors.request.use(function (aa) {
//     console.log(aa);
//     return aa
// });

export default http